﻿@model ProductDetailsModel.ProductVariantModel.AddToCartModel
@using Nop.Web.Models.Catalog;
@using Nop.Core.Domain.Orders;
<div class="add-to-cart">
    @if (Model.CustomerEntersPrice)
    {
        <div class="customer-entered-price">
            <div class="price-input">
                @Html.LabelFor(model => model.CustomerEnteredPrice, new { @class = "enter-price-label" }, ":")
                @*round price*@
                @Html.TextBox("CustomerEnteredPrice", Convert.ToInt32(Math.Ceiling(Model.CustomerEnteredPrice)), new { @class = "enter-price-input" })
            </div>
            <div class="price-range">
                @Model.CustomerEnteredPriceRange
            </div>
        </div>
    }
    @if (!Model.DisableBuyButton || !Model.DisableWishlistButton)
    {
        <div class="add-to-cart-panel">
            @Html.LabelFor(model => model.EnteredQuantity, new { @class = "qty-label" }, ":")
            @if (Model.AllowedQuantities.Count > 0)
            {
                @Html.DropDownListFor(model => model.EnteredQuantity, Model.AllowedQuantities, new { @class = "qty-dropdown" })
            }
            else
            {
                @Html.TextBoxFor(model => model.EnteredQuantity, new { @class = "qty-input" })
            }
            @if (!Model.DisableBuyButton)
            {
                <input type="button" class="button-1 add-to-cart-button" value="@(Model.AvailableForPreOrder ? T("ShoppingCart.PreOrder") : T("ShoppingCart.AddToCart"))" data-productvariantid="@Model.ProductVariantId" onclick="AjaxCart.addproductvarianttocart('@Url.RouteUrl("AddProductVariantToCart", new { productVariantId = Model.ProductVariantId, shoppingCartTypeId = (int)ShoppingCartType.ShoppingCart })', '#product-details-form');return false;" />
            }
            @if (!Model.DisableWishlistButton)
            {
                <input type="button" class="button-2 add-to-wishlist-button" value="@T("ShoppingCart.AddToWishlist")" data-productvariantid="@Model.ProductVariantId" onclick="AjaxCart.addproductvarianttocart('@Url.RouteUrl("AddProductVariantToCart", new { productVariantId = Model.ProductVariantId, shoppingCartTypeId = (int)ShoppingCartType.Wishlist })', '#product-details-form');return false;" />
            }
        </div>
    }
    @Html.Widget("productdetails_add_info")
</div>
